import { request } from "@/utils/index.ts"

import type { ResType } from "./share"

// 定义具体的接口类型
export type ChannelItem = {
  id:number,
  name:string
}

type ChannelRes = {
  channels:ChannelItem[]
}

// 请求频道列表
export const getChannelListAPI = () => {
  return request.request<ResType<ChannelRes>>({
    url: '/channels',
  })
}



// 请求评论列表
type ListItem = {
  art_id:string,
  title:string,
  aut_id:string,
  comm_count:number,
  pubdate:string,
  aut_name:string,
  is_top:number,
  cover:{
    type:number,
    images:string[]
  }
}

export type ListRes = {
  results:ListItem[],
  pre_timestamp:string
}

type Params = {
  channel_id:string,
  timestamp:string
}
export const getCommentList = (params:Params) => {
  return request.request<ResType<ListRes>>({
    url:'/articles',
    params
  })
}